//
//  FGYMYTableView.m
//  01 - shop
//
//  Created by ma c on 16/8/17.
//  Copyright (c) 2016年 beijing. All rights reserved.
//

#import "FGYMYTableView.h"
#import "FGYMYTableViewCell.h"

@interface FGYMYTableView ()<UITableViewDelegate,UITableViewDataSource>

@property (strong, nonatomic) NSArray * dataArray;

@end

@implementation FGYMYTableView

- (NSArray *)dataArray{
    
    if (!_dataArray) {
        _dataArray = [[NSArray alloc]initWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"FGYMY.plist" ofType:nil]];
    }
    return _dataArray;
}


- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style{
    if (self = [super initWithFrame:frame style:style]) {
        self.dataSource = self;
        self.delegate = self;
        self.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.bounces = NO;
    }
    return self;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    FGYMYTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"FGYMYTableViewCell"];
    if (!cell) {
        cell = [[FGYMYTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"FGYMYTableViewCell"];
    }
    cell.dict = self.dataArray[indexPath.row];
        if (indexPath.row == 3) {
            
            UILabel *phoneNum = [[UILabel alloc]init];
            phoneNum.textColor = [UIColor colorWithRed:123 / 255.0 green:124 / 255.0 blue:128 / 255.0 alpha:1];
            phoneNum.text = @"400-100-1111";
            [cell addSubview:phoneNum];
            
            __weak typeof (cell) weakSelf = cell;
            [phoneNum mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(weakSelf.mas_right).offset(-15);
                make.centerY.equalTo(weakSelf.mas_centerY);
                make.size.mas_equalTo(CGSizeMake(110, 15));
            }];
        }

    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50.0;
}

@end
